<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Admin_page_add extends CI_Controller {
	
	function index()
	{
		$data['error'] ='display: none;';
		$data['produit']  ='active';
		if($this->session->userdata('email') || $this->session->userdata('logged'))
		{	
				$data['title'] = 'Admin produits';
				$this->load->model('admin_model');	
				$data['produits'] = $this->home_model->list_produits();	
				$data['message'] = $this->admin_model->list_message();
				$data['content'] = 'admin/admin_page_add';
				$data['produit']  ='active';
				$this->load->view('admin/template/template',$data);
		}
		else 
		{
			$this->load->view('admin/signup',$data);
		}
	}


function add_content()
	{
		$data['error'] ='display: none;';
		$data['produit']  ='active';	
			
			if ($this->uri->segment(3)) 
			{
			$this->load->model('admin_model');	
			$this->load->model('home_model');

			$data['rows'] = $this->admin_model->get_produits($this->uri->segment(3));
			// variable transmis à la vue
			$data['id'] = $data['rows']->id_produits;
			$data['title_fr'] = $data['rows']->title_fr;

			$data['content'] = 'admin_page_add';
		 

			} 
			else 
			{
				redirect('admin_produits');
			}
			
			   // on charge la page dans le template
		   $data['message'] = $this->admin_model->list_message();	
			$data['content'] = 'admin/admin_produits';
			$data['success'] = 'display:block;';
			$this->load->view('admin/template/template',$data);
			
		}



	
}		
?>